 $(function(){
 	//横屏时提示
	window.addEventListener("orientationchange", function(){
	    if(window.orientation != 0){
	        alert('为保证最佳浏览体验，请使用竖屏 :)');
	    }
	}, false);
    //预加载
		 var load = new Load(function (p) {
            //var text = $("#load .text");
            var loader_n = $('.loader_n_con');
            loader_n.css('height',(p*95)+'px');
           // text.html(parseInt(p * 100) + "%");
            /*$("#load .action1").addClass("on");
            $("#load .action2").addClass("on");*/
        }, loadComplete, [
    			'load_txt.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/load_txt.png*/,
          'load_txt1.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/load_txt1.png*/,
    			'logo.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/logo.png*/,
          'logo1.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/logo1.png*/,
          'fen.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/fen.png*/,
          //'http://app.cnzhuoyue.net/20180226_suning/Public/js/fonts/FZRuiZHJW_Cu_0.TTF',
          'slider1.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/slider1.png*/,
          'slider2.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/slider2.png*/,
          'slider3.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/slider3.png*/,
          'slider4.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/slider4.png*/,
          'slider5.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/slider5.png*/,
          'slider6.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/slider6.png*/,
          'shu_bj.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/shu_bj.png*/,
          'shu_title.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/shu_title.png*/,
          'file_up.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/file_up.png*/,
          'yulan_btn.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/yulan_btn.png*/,
          'yulan_btn.png'/*tpa=http://app.cnzhuoyue.net/20180226_suning/Public/img/yulan_btn.png*/
		],30);
		 score = 0;
        $(function () {
            load.Start();
        })
        function loadComplete() {
           //alert('加载完成');
           $("#load").addClass("out");
           $(".p1").show();

        }
	//预加载
	//Progress:function handler(progress){//使用当前进度},
	//Complete:function handler(){//加载完成后执行},
	//imglist:[uri1,uri2,uri3,....],
	//delay:nubmer
	function Load(Progress, Complete, imglist, delay) {
	    var complete = 0;
	    var count = imglist.length;
	    var currentProgress = 0;
		
		    function _animate() {
		        var completeProgres = complete / count;
		        currentProgress = (currentProgress + 0.01) < completeProgres ? (currentProgress + 0.01) : completeProgres;
		        if (Math.floor(currentProgress * 100) < 100) {
		            Progress(currentProgress);
		            setTimeout(_animate, delay);
		        } else {
		            setTimeout(function () {
		                Progress(1);
		                setTimeout(function () {
		                    Complete();
		                }, 200);
		            }, delay);
		        }
		    }
	    this.Start = function () {
	        for (var i = 0; i < count; i++) {
	            var img = new Image();
	            img.onload = function () {
	                complete++;
	                if (!Progress && complete == count) {
	                    Complete();
	                }
	            };
	            img.src = imglist[i];
	        }
	        if (Progress) {
	            _animate();
	        }
	    }
	}

 
 

})
//toast.js
function toast(m){
  var c = "toast_active";
  var f = document.createElement("div");
  return f.classList.add("toast_container"),
  f.innerHTML = '<div class="toast_message">' + m + "</div>",
  f.addEventListener("webkitTransitionEnd",
            function() {
                f.classList.contains(c) || (f.parentNode.removeChild(f), f = null)
            }),
    f.addEventListener("click",
    function() {
        f.parentNode.removeChild(f),
        f = null
    }),
    document.body.appendChild(f),
    f.classList.add(c),
    setTimeout(function() {
        f && f.classList.remove(c)
    },1500)
}

//判断浏览器
 /*var brower = {
   version:function(){
     var u = navigator.userAgent, app = navigator.appVersion;
     return {  //移动端浏览器版本信息
       ios: !!u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,//android终端或uc浏览器
       iphone:u.indexOf('iPhone') > -1,  //是否为iPhone或者QQHD浏览器
       ipad:u.indexOf('iPad') > -1,  //是否为iPad
     };
   }(),
 }*/
 $(function(){
      var width = $(window).width();
      var height = $(window).height();
     // alert(height);
     $('.color').click(function(){
        var color = $(this).data('color');
        //alert(color);
        $('.swiper-slide7').css('background',color);
        $('.swiper-slide7').data('src',color);
     });


      /*$(".js_upFile").uploadView({
            uploadBox: '.js_uploadBox', //设置上传框容器
            showBox: '.js_showBox', //设置显示预览图片的容器
            width: width, //预览图片的宽度，单位px
            height: height, //预览图片的高度，单位px
            allowType: ["gif", "jpeg", "jpg", "bmp", "png"], //允许上传图片的类型
            maxSize: 10, //允许上传图片的最大尺寸，单位M
            success: function(e) { 
                $('.js_showBox').hide();
                var url = $('.js_showBox').find('img').attr('src');
               // alert(url);
                $('.swiper-slide7').data('src',url);
               $('.swiper-slide7').css({'background':'url('+url+') no-repeat left top','background-size':'100% '+height+'px'});
               toast('图片上传成功');
            }
        });*/
 })

   
